import numpy as np
import scipy.stats

# 1、未知总体标准差求期望
data_list = [422.2, 417.2, 425.6, 425.8, 423.1, 418.7, 428.2, 438.3, 434.0, 412.3, 431.5, 413.5, 441.3, 423.0, 420.3]
mean = np.mean(data_list)
s = np.sem(data_list) #样本标准差
n = 15
alpha = 1 - 0.95

t = scipy.stats.t.isf(alpha / 2, df=n - 1)  # 与test1公式不同,df为修改后的自由度
ME = t * s
low = mean - ME
up = mean + ME
print("({0},{1})".format(round(low, 5), round(up, 5)))
